<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.controller');

class JobBoardControllerJaFeeds extends JobBoardController{
	function __construct()
	{
		parent::__construct();	
		
	}

	function display()
	{
		parent::display();
	}

	function save()
	{
		$model = $this->getModel('jafeeds');
		JArrayHelper::toInteger($cid, array(0));
		if ($id=$model->store()) {
			
			$msg = JText::_( 'Successfully created feed' );
			$this->setRedirect(JRoute::_("index.php?option=". JBCOMNAME ."&view=jafeeds&layout=feed_link&cid[]=$id&Itemid=1000"),$msg);
		} else {
			JError::raiseWarning(1,JText::_('Error found!Fail to save feed' ));
//			JRequest::setVar('option',JBCOMNAME);
//			JRequest::setVar('view','jafeeds');
			JRequest::setVar('Itemid','1000');
			JRequest::setVar('layout','form');
			JRequest::setVar('postback',true);
			
			parent::display();
		}
		
//		$this->setRedirect( JRoute::_("index.php?option=".JBCOMNAME."&view=jafeeds&cid[]=$id"), $msg );
		
	}
	function cancel()
	{
		$Itemid = JRequest::getVar('Itemid');
        $this->setRedirect(JRoute::_("index.php?option=". JBCOMNAME ."&view=jafeeds&layout=guide&Itemid=".$Itemid));
	}
}